(function (window, $, document, undefined) {
    var basePath = $('#basePath').val(),
        positionId = $('#positionId').attr("positionId"),
        statusId = $("#statusId").attr("statusId");

    //这个函数作用域用于初始化页面中的菜单项选中的颜色标识
    (function () {
        $(".linkImageNav a[positionId=" + positionId + "]").addClass("leftNavSelected");
        $(".imageStatusNav a[statusId=" + statusId + "]").addClass("topNavSelected");
    })();

    //为导航栏添加点击事件
    (function () {
        $(".linkImageNav").on("click", "a", function (event) {
            event.preventDefault();
            var $this = $(this), targetPositionId = $this.attr("positionId");
            window.location = basePath + "positionImage/enterLinkImageManage.do?position=" + targetPositionId + "&status=" + statusId;
        });

        $(".imageStatusNav").on("click", "a:not(:last)", function (event) {
            event.preventDefault();
            var $this = $(this), targetStatusId = $this.attr("statusId");
            window.location = basePath + "positionImage/enterLinkImageManage.do?position=" + positionId + "&status=" + targetStatusId;
        });
    })();
})(window, jQuery, document);